<template>
	<view>
		<custom title="首页" :hiddenBack="true" background="rgba(255,255,255,0.5)"></custom>
		<view class="tool-list">
			<view @tap.stop="toPage(item)" v-if="item.show !== false" class="tool-item hover-o"
				v-for="(item,index) in toolList" :key="index">
				<view class="tool-image iconfont" :class="item.icon"></view>

				<text>{{item.name}}</text>
			</view>

		</view>
		<index-page-animation></index-page-animation>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				toolList: [
					//
					{
						name: '快捷记分',
						icon: 'icon-xiugailiaohao',
						path: '/pages/tool-1/tool-1',
					},
					{
						name: '记分记录',
						icon: 'icon-jilu',
						path: '/pages/history/history',
					},
					{
						name: '九宫格图片',
						icon: 'icon-jiugongge',
						path: '/pages/wechat/wechat',
						show: false,
					},
					{
						name: '关于我们',
						icon: 'icon-guanyuwomen',
						path: '/pages/about/about',
					}
				],
			}
		},
		onLoad() {

		},
		methods: {
			openPassword() {
				this.$refs.password.open();
			},
			toPage(item) {
				if (!item.path) {
					uni.showToast({
						icon: 'none',
						title: '敬请期待'
					})
					return;
				}
				if (item.path == 'wechat') {
					plus.runtime.openURL('/static/wechat.html');
					return;
				}
				uni.navigateTo({
					url: item.path
				});
			},
		},
		onShareAppMessage() {
			return {
				title: '记分小助手',
			}
		},
		onShareTimeline() {
			return {
				title: '记分小助手',
			}
		},
	}
</script>

<style>
	page {
		background-color: #f7f7f7;
	}

	.tool-list {
		margin-top: 10rpx;
		padding: 0 30rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		flex-wrap: wrap;
		position: relative;
		z-index: 4;
	}

	.tool-item {
		border-radius: 5px;
		width: 330rpx;
		height: 160rpx;
		display: flex;
		flex-direction: row;
		font-size: 34rpx;
		align-items: center;
		font-weight: 600;
		margin-top: 20rpx;
		color: #000;
		transition: all 0.2s;
		background-color: rgba(255, 255, 255, 0.5);
		position: relative;
	}

	.tool-item:active {
		background-color: rgba(255, 255, 255, 0.4);
	}

	.tool-image {
		width: 80rpx;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 10rpx;
	}
</style>